package com.edu.cdp.utils;

import java.util.Random;

public class VerificationCodeUtils {
    private static final Random RANDOM = new Random();

    /**
     * 生成6位数字的随机验证码
     * @return 6位数字组成的字符串
     */
    public static String generateSixDigitCode() {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 6; i++) {
            sb.append(RANDOM.nextInt(6));
        }

        return sb.toString();
    }

    public static void main(String[] args) {
        // 测试生成验证码方法
        String code = generateSixDigitCode();
        System.out.println("验证码: " + code);
    }
}
